﻿using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WxBean.Core.Model;

namespace WxBean.Core.Services
{
    /// <summary>
    /// 漫画抽象接口
    /// </summary>
    public interface IComic
    {

        public static List<ComicModelDto> comicList = new List<ComicModelDto>();

        Task<IEnumerable<ComicModelDto>> ExecuteAsync(WebBasic webBasic, string name);

        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public Task<HtmlDocument> GetHtmlDocumentAsync(string path);


        /// <summary>
        /// 是否存在数字
        /// </summary>
        /// <param name="lastUpdateTo"></param>
        /// <returns></returns>
        public bool IsExistNumbers(string lastUpdateTo)
        {
            if (string.IsNullOrEmpty(lastUpdateTo))
            {
                return false;
            }

            // 判断字符串中是否存在数字
            var hasNumber = Regex.IsMatch(lastUpdateTo, @"\d+");
            if (!hasNumber)
            {
                return false;
            }

            return true;
        }

    }
}
